/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package prototype.adaptor;

import prototype.persistence.pojo.Goal;
import prototype.runtime.impl.goal.AnnihilateEnemyGoal;
import prototype.runtime.impl.goal.CaptureAreaGoal;
import prototype.runtime.impl.goal.KillCiviliansGoal;
import prototype.runtime.impl.goal.ProtectCiviliansGoal;
import prototype.runtime.interfaces.RuntimeGoal;

/**
 *
 * @author Server
 */
public class RuntimeGoalFactory {

    public static final int GOAL_ANNIHILATE = 1;
    public static final int GOAL_KILL_CIV = 2;
    public static final int GOAL_PROTECT_CIV = 3;
    public static final int GOAL_CAPTURE_AREA = 4;
    private static RuntimeGoalFactory instance;

    static {
        instance = new RuntimeGoalFactory();
    }

    static RuntimeGoalFactory getInstance() {
        return instance;
    }

    public RuntimeGoal newRuntimeGoal(Goal goal) {
        RuntimeGoal runtimeGoal;

        switch (goal.getType()) {
            case GOAL_ANNIHILATE:
                runtimeGoal = new AnnihilateEnemyGoal();
                break;
            case GOAL_KILL_CIV:
                runtimeGoal = new KillCiviliansGoal();
                break;
            case GOAL_PROTECT_CIV:
                runtimeGoal = new ProtectCiviliansGoal();
                break;
            case GOAL_CAPTURE_AREA:
                runtimeGoal = new CaptureAreaGoal();
                break;
            default:
                runtimeGoal = new AnnihilateEnemyGoal();
        }
        runtimeGoal.setGoal(goal);

        return runtimeGoal;
    }
}
